<template>
  <el-container class="bgBox bgImg" v-loading="loading">
    <div class="container">
      <div class="row">
        <div class="col">
          <el-tabs v-model="activeName">
            <el-tab-pane class="col" :label="`帖子${topic.length}`" name="first">
              <slot v-bind="{topic}"></slot>
            </el-tab-pane>
          </el-tabs>
        </div>
      </div>
    </div>
  </el-container>
</template>

<script>
import { mapGetters } from "vuex";
import { asyncgettopicbyuser } from "../../../plugins/api.js";
export default {
  data() {
    return {
      topic: [],
      activeName: "first",
      loading: true
    };
  },
  watch: {
    $route() {
      this.start();
    }
  },
  computed: {
    ...mapGetters(["getuser"]),
    uid() {
      return this.$route.params.uid;
    }
  },
  mounted() {
    this.start();
  },
  methods: {
    async start() {
      this.loading = true;
      try {
        this.topic = await asyncgettopicbyuser({ uid: this.uid });
      } catch (err) {
        this.error = true;
      }
      this.loading = false;
    }
  }
};
</script>

<style scoped>
.bgImg {
  background: url("https://cdn-hterobot.oss-cn-qingdao.aliyuncs.com/vue/public/forum/bgImg.png")
    no-repeat;
  padding-top: 120px;
  background-size: 100% 100%;
}
</style>
<style>
#app .bgBox .el-tabs__item.is-active {
  color: #000;
}
</style>